feat: add whoami command#657
Open
apucacao wants to merge 4 commits into
Open
Conversation
Adds `ldcli whoami` which calls /api/v2/caller-identity to show information about the identity associated with the current access token (token name, auth kind, member ID, scopes, etc.). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes --access-token requirement from whoami — the command reads the token from config/env (like ldcli login sets up), matching the pattern of gh auth status and similar commands. Also hides --access-token, --base-uri, and --analytics-opt-out from whoami's help output since they're not relevant to this command. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches /api/v2/members/{id} after caller-identity when a memberId
is present, giving plaintext output like:
Ariel Flores <ariel@acme.com>
Role: admin
Token: my-api-token (personal)
JSON output remains the raw caller-identity response for scripting.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a084c44 to
8bcd612
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
N/A
Describe the solution you've provided
Adds
ldcli whoami— shows who your current access token belongs to. Reads from config/env like other commands, so you don't need to pass--access-tokenexplicitly (similar togh auth status).Describe alternatives you've considered
N/A
Additional context
Note
Low Risk
Low risk: adds a new read-only CLI command and minimal root-command wiring, with no changes to auth flows beyond calling existing APIs using the configured token.
Overview
Adds a new
ldcli whoamicommand that callsGET /api/v2/caller-identityusing the configured access token and prints the current caller identity.Supports
--output jsonby returning the raw API response, and for plaintext output optionally enriches display by fetching member details fromGET /api/v2/members/{id}. Root command wiring is updated to registerwhoamiand exempt it from required-flag parsing; new tests cover plaintext, JSON, and missing-token behavior.Reviewed by Cursor Bugbot for commit 8bcd612. Bugbot is set up for automated code reviews on this repo. Configure here.